<?php
use yii\helpers\Url;
$this->context->layout = false;
?>
<?php
//使用率
echo $this->render("@app/views/public/useRate.php")
?>
<div id="History-Destroy-List"></div>
<script type="text/x-kendo-template" id="HistoryDestroyTemplate">
    <a class="k-button k-button-icontext" onclick="onHistory()"><span class="glyphicon glyphicon-align-justify"></span>修改历史</a>
    <a class="k-button k-button-icontext btn btn-info btn-lg active"   onclick="onDestroyHistory()"><span class="glyphicon glyphicon-align-justify"></span>删除历史</a>
    <input type="text" id="hd_date_month"  name="hd_date_month" value="<?=$date?>" placeholder="月份">
    <span id="HistoryDeductions"></span>
</script>
<script>
    var History_Destroy_grid = $("#History-Destroy-List");
    $(document).ready(function() {
        History_Destroy_grid.kendoGrid({
            dataSource: {
                transport: {
                    read:function (e) {
                        $.ajax({
                            url: "<?=Url::to(['destroyhistorylist','hd_date_month'=>'']); ?>"+$("#hd_date_month").val(),
                            dataType: "json",
                            success:function (redata) {
                                e.success(redata);
                            }
                        })
                    }
                },
                schema: {
                    model: {
                        fields: {
                            created: { field:"created",type:"date"},
                            deleteTime: { field:"deleteTime",type:"date"},
                            destroyBy: { field:"destroyBy"},
                            createBy: { field:"createBy"},
                            column: { field:"column"},
                            level1Name: { field:"level1Name"},
                            level2Name: {field:"level2Name"},
                            content: {field:"content"}
                        }
                    }
                },
                pageSize: 20
            },
            sortable: true,
            // reorderable: true,
            // resizable: true,
            // columnMenu: true,
            filterable: {
                extra: false,
                operators: {
                    string: {
                        contains: "包含",
                        doesnotcontain: "不包含",
                        eq: "等于",
                        neq: "不等于"
                    }
                }
            },
            toolbar:kendo.template($("#HistoryDestroyTemplate").html()),
            pageable:{
                refresh: true,
                pageSizes: [20, 40, 60, "all"],
                buttonCount: 5
            },
            columns: [
                {
                    field:"deleteTime",
                    title: "删除时间(美国)" ,
                    format: "{0:MM/dd/yyyy hh:mm}",
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field:"created",
                    title: " 发布时间(美国)" ,
                    format: "{0:MM/dd/yyyy HH:mm}",
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field:"department_name",
                    title:"部门",
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field:"group_name",
                    title:"组别",
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "destroyBy",
                    title:"删除人" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "createBy",
                    title:"被删除人" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "column",
                    title:"三类别" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "level1Name",
                    title:"错误一级类别" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "level2Name",
                    title:"错误二级类别" ,
                    headerAttributes: alignCenterAttribute,
                    attributes: alignCenterAttribute
                },
                {
                    field: "content",
                    title:"详情" ,
                    width:"30%"
                }
            ]

        });
        $("#hd_date_month").kendoDatePicker({
            start: "year",
            depth: "year",
            format: "yyyy/MM",
            change:function(e){
                var __grid = History_Destroy_grid.data("kendoGrid");
                __grid.dataSource.read();
                __grid.refresh();
            }
        });
    });
</script>
